package com.github.baichuan.application.scaffold.rest.dto.role;

import com.github.baichuan.application.scaffold.rest.domain.application.Application;
import com.github.baichuan.application.scaffold.rest.domain.identity.ApplicationMember;
import com.github.baichuan.application.scaffold.rest.jpa.authorization.RoleSpecification;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NonNull;

@Schema(title = "角色查询条件")
@Getter
public class RoleQueryCriteria {

    @Schema(title = "角色名称")
    private String keyword;

    public RoleSpecification specification(Application application, @NonNull ApplicationMember applicationMember) {
        return RoleSpecification.builder()
                .application(application)
                .applicationMember(applicationMember)
                .keyword(keyword)
                .build();
    }
}
